#include "UnaryExpr.h"
#include "PostfixExpr.h"
#include "UnaryOperator.h"
#include "CastExpr.h"
#include "../../symtab/symtab.h"
#include <iostream>
#include <string>

UnaryExpr::~UnaryExpr(void)
{
	switch(m_iType)
	{
	case postfix_expr:
		delete m_pPostfixExpr;
		break;
	case op_cast_expr:
		delete m_pOpCastExpr;
		delete m_pOperator;
		break;
	case plus_unary_expr:
	case sub_unary_expr:
	case sizeof_expr:
		delete m_pUnaryExpr;
		break;
	case sizeof_type:
		break;
	default:
		std::cout<<"UnaryExpr::~UnaryExpr(), Unknown type!\n"<<std::endl;
		exit(1);
	}
}

void UnaryExpr::codeGen()
{
	COUT
	switch(m_iType)
	{
	case postfix_expr:
		m_pPostfixExpr->codeGen();
		break;
	case op_cast_expr:
		m_pOpCastExpr->codeGen();
		m_pOperator->codeGen();
		break;
	case plus_unary_expr:
	case sub_unary_expr:
	case sizeof_expr:
		m_pUnaryExpr->codeGen();
		break;
	case sizeof_type:
		break;
	default:
		std::cout<<"UnaryExpr::codeGen(), Unknown type!\n"<<std::endl;
		exit(1);
	}
}